{include file="public/header"/}
</head>
<body>
<div class="layui-form">
    <div class="layui-fluid pd83">
        <div class="layui-col-sm12">
            <div class="layui-card pcf30">
                <div class="layui-form-item">
                    <label class="layui-form-label"><b class="pcfts">*</b> 账号</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                    <input name="user_name" value="" class="layui-input" type="text" lay-verType="tips" lay-verify="required" required>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><b class="pcfts">*</b> 登录密码</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input name="password" type="password" value="" class="layui-input" maxlength="20" lay-verType="tips" lay-verify="required" required/>
                        输入大于6位且小于16位密码
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><b class="pcfts">*</b> 确认密码</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                     <input type="password" name="password2" id="password2" value="" autocomplete="off" class="layui-input" lay-verType="tips" lay-verify="required|check_password2" required>
                     输入大于6位且小于16位密码
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">昵称</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input name="pen_name" value="" type="text" class="layui-input" maxlength="20"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input name="mobile" value="" type="text" class="layui-input" maxlength="20"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input name="email" value="" type="text" class="layui-input" maxlength="20"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input type="radio" name="sex" value="男" title="男" checked/>
                        <input type="radio" name="sex" value="女" title="女"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">角色</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        {if ($role_id < 0)}
                        <input type="radio" lay-filter="type" name="role_id" value="-1" lay-filter="role_id" title="超级管理员" checked><br>
                        {/if}
                        {volist name="roleList" id="vo"}
                        <input type="radio" lay-filter="type" name="role_id" value="{$vo.id}"  title="{$vo.name}" {if isset($vo['checked']) && $vo['checked']}checked=""{/if}><br>
                        {/volist}
                    </div>
                </div>
                <div class="pcfclear"></div>
            </div>
        </div>
        <div class="pcfclear"></div>
    </div>
    <div class="submit-info text-center">
        <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
    </div>
</div>
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
            form.on('submit(formSubmit)', function(data){
                layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
                $.ajax({
                    type : 'post',
                    url : "{:url('/admin/add')}",
                    data : data.field,
                    dataType : 'json',
                    success : function(res){
                        layer.closeAll('loading');
                        if(res.status){
                            layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                                parent.window.location.href = res.url;
                            });
                        }else{
                            layer.msg(res.msg, {icon: 2, time: 1000});
                        }
                    },
                    error: function(e){
                        layer.closeAll('loading');
                        layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                    }
                });
                return false;
            })
    });
</script>
</body>
</html>